home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / srcuc.zip / HPPANEWC.C < prev    next >
C/C++ Source or Header  |  1992-01-07  |  4KB  |  140 lines

  1. /* -*-C-*-
  2.  
  3. $Header: /scheme/src/microcode/RCS/hppanewcache.c,v 1.1 1992/01/07 16:53:10 jinx Exp $
  4.  
  5. Copyright (c) 1992 Massachusetts Institute of Technology
  6.  
  7. This material was developed by the Scheme project at the Massachusetts
  8. Institute of Technology, Department of Electrical Engineering and
  9. Computer Science.  Permission to copy this software, to redistribute
  10. it, and to use it for any purpose is granted, subject to the following
  11. restrictions and understandings.
  12.  
  13. 1. Any copy made of this software must include this copyright notice
  14. in full.
  15.  
  16. 2. Users of this software agree to make their best efforts (a) to
  17. return to the MIT Scheme project any improvements or extensions that
  18. they make, so that these may be included in future releases; and (b)
  19. to inform MIT of noteworthy uses of this software.
  20.  
  21. 3. All materials developed as a consequence of the use of this
  22. software shall duly acknowledge such use, in accordance with the usual
  23. standards of acknowledging credit in academic research.
  24.  
  25. 4. MIT has made no warrantee or representation that the operation of
  26. this software will be error-free, and MIT is under no obligation to
  27. provide any services, by way of maintenance, update, or otherwise.
  28.  
  29. 5. In conjunction with products arising from the use of this material,
  30. there shall be no use of the name of the Massachusetts Institute of
  31. Technology nor of any adaptation thereof in any advertising,
  32. promotional, or sales literature without prior written consent from
  33. MIT in each case. */
  34.  
  35. /* Program to convert ascii-format cache descriptions into the binary
  36.    form used by Scheme.
  37.  
  38.    To use, replace the structure labeled "written_data" below with the
  39.    new one (if not present in the data base), then recompile this program:
  40.      cc -Aa -D_HPUX_SOURCE -O -o hppanewcache hppanewcache.c
  41.    and then type
  42.      ./hppanewcache >>HPPAmodels
  43.  */
  44.  
  45. #include <stdio.h>
  46. #include "hppacache.h"
  47.  
  48. struct pdc_cache_written
  49. {
  50.   char hardware[sizeof (utsname.machine)];
  51.   struct pdc_cache_result cache_format;
  52. };
  53.  
  54. static struct pdc_cache_written written_data =
  55. {
  56.   /* Cache description for amertume, an HP PA 9000/750 processor. */
  57.  
  58.   "9000/750",
  59.  
  60.   {
  61.     /*
  62.       I-cache information:
  63.     size        262144 bytes (256 K).
  64.     conf        0x01402000
  65.     base        0x0
  66.     stride        32 bytes.
  67.     count        8192 entries.
  68.     loop        1 association per entry.
  69.     block size    1 line.
  70.     line size    2 (16-byte units).
  71.       It is a read-only cache.
  72.       It issues coherent operations.
  73.       Both FDC and FIC must be used to flush.
  74.     */
  75.     { 262144, 0x01402000, 0x0, 32, 8192, 1 },
  76.     /*
  77.       D-cache information:
  78.     size        262144 bytes (256 K).
  79.     conf        0x01402000
  80.     base        0x0
  81.     stride        32 bytes.
  82.     count        8192 entries.
  83.     loop        1 association per entry.
  84.     block size    1 line.
  85.     line size    2 (16-byte units).
  86.       It is a write-to cache.
  87.       It issues coherent operations.
  88.       Both FDC and FIC must be used to flush.
  89.     */
  90.     { 262144, 0x01402000, 0x0, 32, 8192, 1 },
  91.     /*
  92.       I-TLB information:
  93.     size        96 entries (0 K).
  94.     conf        0x00012000
  95.     sp_base        0x0
  96.     sp_stride    0
  97.     sp_count    1
  98.     off_base    0x0
  99.     off_stride    0
  100.     off_count    1
  101.     loop        1 association per entry.
  102.       It issues coherent operations.
  103.       Both PDTLB and PITLB must be used to purge.
  104.     */
  105.     { 96, 0x00012000, 0x0, 0, 1, 0x0, 0, 1, 1 },
  106.     /*
  107.       D-TLB information:
  108.     size        96 entries (0 K).
  109.     conf        0x00002000
  110.     sp_base        0x0
  111.     sp_stride    0
  112.     sp_count    1
  113.     off_base    0x0
  114.     off_stride    0
  115.     off_count    1
  116.     loop        1 association per entry.
  117.       It issues coherent operations.
  118.       Both PDTLB and PITLB must be used to purge.
  119.     */
  120.     { 96, 0x00002000, 0x0, 0, 1, 0x0, 0, 1, 1 }
  121.   }};
  122.  
  123. #define INTMIN(x,y) (((y) > (x)) ? (y) : (x))
  124.  
  125. main ()
  126. {
  127.   struct pdc_cache_dump data_to_dump;
  128.  
  129.   memcpy (&data_to_dump.hardware, &written_data.hardware,
  130.       (INTMIN ((sizeof (data_to_dump.hardware)),
  131.            (sizeof (written_data.hardware)))));
  132.   memcpy (&data_to_dump.cache_format, &written_data.cache_format,
  133.       (INTMIN ((sizeof (data_to_dump.cache_format)),
  134.            (sizeof (written_data.cache_format)))));
  135.   fprintf (stderr, "Writing %d bytes...\n", (sizeof (data_to_dump)));
  136.   fflush (stderr);
  137.   write ((fileno (stdout)), &data_to_dump, (sizeof (data_to_dump)));
  138.   exit (0);
  139. }
  140.